package com.wanmait.zaisousuo.mapper;

import com.github.pagehelper.PageInfo;
import com.wanmait.zaisousuo.pojo.ArticleComment;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ArticleCommentMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(ArticleComment record);

    int insertSelective(ArticleComment record);

    ArticleComment selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ArticleComment record);

    int updateByPrimaryKey(ArticleComment record);

    //根据文章id查出所有评论
    List<ArticleComment> findAllByArticleId(Integer id);

    //根据文章id查询出所有的顶级评论
    List<ArticleComment> findAllTopComments(@Param("id") Integer id, @Param("pageNum") Integer pageNum);


    List<ArticleComment> findAllChildrenCommentsById(@Param("id") Integer id);

    //添加评论
    void addOneComment(ArticleComment articleComment);


    //所属父级的子类数量+1
    void increaseOneChildren(Integer id);

    //删除相关评论
    void deleteRelativeComments(Integer articleId);
}